#!/usr/bin/perl 
 
require "./qqwry.pl";
#my $pattern_ip = '\(((?:(?:1?[0-9]?[0-9]|2(?:[0-4][0-9]|5[0-5]))\.){3}(?:1?[0-9]?[0-9]|2(?:[0-4][0-9]|5[0-5])))\)';
my $pattern_ip = '((?:(?:1?[0-9]?[0-9]|2(?:[0-4][0-9]|5[0-5]))\.){3}(?:1?[0-9]?[0-9]|2(?:[0-4][0-9]|5[0-5])))';
my $line,$matches, $match, $ip_geo_addr;
while($line = <STDIN>){
    chomp $line ;
    @matches = $line =~ /$pattern_ip/g;
    foreach $match (@matches){
         $ip_geo_addr = &ipwhere($match);
         print "$line \t $ip_geo_addr\n" ;
#         #$line =~ s/$match/$match\t[$ip_geo_addr]/;
#         $line =~ s/$line/$line  [$ip_geo_addr]/;
    }
#print $line;
}
         
1;


